package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenQuotationSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerQuotationAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.quotation.Quotation;
import com.wlyuan.open.scanner.repository.QuotationRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.QUOTATION)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerQuotationHandler extends BaseScannerHandler<Quotation, OpenQuotationSyncDTO> {
    private final QuotationRepository quotationRepository;

    @Override
    protected List<Quotation> select() {
        return quotationRepository.list();
    }

    @Override
    protected List<OpenQuotationSyncDTO> assembler(List<Quotation> data) {
        return ScannerQuotationAssembler.assemble(data);
    }
}
